import { RegisterConfig, PolylineEdge, PolylineEdgeModel } from '@logicflow/core';
import { nextId } from '../utils';
import { BpmnElements } from '../constant';

class SequenceFlowModel extends PolylineEdgeModel {
  static extendKey = 'SequenceFlowModel';
  constructor(data:any, graphModel:any) {
    data.id = data.id?data.id:`Flow_${nextId()}`;
    data.text = data.text?data.text:'';
    super(data, graphModel);
  }
}

class SequenceFlowView extends PolylineEdge {
  static extendKey = 'SequenceFlowEdge';
}

const SequenceFlow:RegisterConfig = {
  type: BpmnElements.SequenceFlow,
  view: SequenceFlowView,
  model: SequenceFlowModel,
};

export { SequenceFlowView, SequenceFlowModel };
export default SequenceFlow;
